package com.ruoyi.video.domain;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * 摄像机树
 */
@Data
public class VideoTree {
    private Long id;
    private String type;
    private String name;

    List<VideoTree> children;

    public void addCamera(VideoCamera videoCamera){
        if(children == null){
            children = new ArrayList<>();
        }
        VideoTree node = new VideoTree();
        node.setName(videoCamera.getName());
        node.setId(videoCamera.getId());
        node.setType("camera");
        children.add(node);
    }

    public static VideoTree groupTree(String name, Long id){
        VideoTree node = new VideoTree();
        node.setName(name);
        node.setId(id+100000000);
        node.setType("group");
        return node;
    }
}
